#ifndef HTTP_CLIENT_H
#define HTTP_CLIENT_H
#include <string>
#include <boost/asio.hpp>
#include <boost\noncopyable.hpp>
#include "connection.h"
#include "connection_manage.h"

using boost::asio::ip::tcp;
namespace jump
{
	namespace client{

		class Client:
			private boost::noncopyable
		{
		public:
			explicit Client(const std::string& arg_server,const std::string& arg_port,int arg_connectLimit);


			void run();

		private:

			void toConnect();

			void handle_resolve(const boost::system::error_code& arg_err,tcp::resolver::iterator arg_endpoint_iterator);
			void handle_connect(const boost::system::error_code& arg_err);


			boost::asio::io_service ioService_;
			tcp::resolver resolver_;

			connection_ptr newConnection_;

			Connection_Manage connectionMgr_;
			tcp::resolver::iterator iterators_;


			int connectLimit;

		};




	}//namespace client

}//namespace jump

#endif